package org.sixtynine.stock.service;

import java.util.Date;
import java.util.List;

/**
 * @author Thilan
 *
 */
import org.hibernate.criterion.Criterion;
import org.sixtynine.stock.dto.GridPramDTO;
import org.sixtynine.stock.dto.Page;
import org.sixtynine.stock.entity.BaseEntity;
import org.sixtynine.stock.entity.Company;
import org.sixtynine.stock.entity.DailyShareData;
import org.sixtynine.stock.entity.User;
import org.springframework.transaction.annotation.Transactional;

/**
 * @author Thilanka
 * 
 */
@Transactional
public interface StockPersistentService {

	public void saveOrUpdate(BaseEntity entity);

	public void delete(BaseEntity entity);

	public BaseEntity findById(int id, Class<? extends BaseEntity> clazz);

	public List<BaseEntity> findByCriteria(Criterion criterion,
			Class<? extends BaseEntity> clazz);

	public List<BaseEntity> findAll(Class<? extends BaseEntity> clazz);

	public List<BaseEntity> findLatestRecords(int numResuts, Class clazz,
			String orderBy, Criterion... criterion);

	public List<DailyShareData> searchDailyShareData(int companyId,
			Date fromDate, Date toDate, String orderBy, String orderByName);

	public User findUserByUserName(String userName);

	public boolean isEmailExist(String email);

	public Page<DailyShareData> searchDailyShareData(int companyId,
			Date fromDate, Date toDate, String orderBy, String orderByName,
			GridPramDTO gridPramDTO);

	public List<Company> searchCompany(int sectorId);
}
